#e
#Title[Hu^IuuAT@-Extra-v]
#Text[Q[oXȂǍlĂ܂]
#PlayLevel[Extra]
#ScriptVersion[2]

script_enemy_main {
 let name = "Hu^IuuAT@-Extra-v";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetMovePosition02(GetCenterX, GetCenterY - 50, startWait);
  SetLife(5000);
  SetTimer(80);
  SetScore(1000000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  LoadUserShotData(GetCurrentScriptDirectory~"shot_All.txt");

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 12);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  wait(startWait);
  TMove;
  TTalismanShot;
  TRandomShot;
 }

 task TMove {
  yield;

  loop {
   SetMovePositionRandom01(50, 50, 0.5, GetCenterX - 80, GetCenterY - 130,
                           GetCenterX + 80, GetCenterY + 30);
   wait(180);
  }
 }

 task TTalismanShot {
  let speed = 1;
  let angle = atan2(GetPlayerY - GetY, GetPlayerX - GetX) - 45;
  let count = 0;
  yield;

  loop {
   loop(10) {
    loop(20) {
     CreateShot01(GetX, GetY, speed, angle, 89, 0);
     angle += 6;
    }
    count += 1;
    speed += 0.3;

    if(count == 1 || count == 2 || count == 3 || count == 4 || count == 5 || count == 6 || count == 7 || count == 8 || count == 9) {
     angle -= 6 * 20;
    }
    if(count == 10) {
     count = 0;
    }

    wait(5);
   }
   speed = 1;
   wait(20);
  }
 }

 task TRandomShot {
  let angle = 0;
  yield;

  loop {
   wait(120);
   angle += rand(90, 270);
   loop(10) {
    loop(4) {
     CreateShot01(GetX, GetY, rand(0.3, 1), angle + rand(-50, 50), rand_int(9, 16), 0);
     CreateShot01(GetX, GetY, rand(0.3, 1), angle + rand(-50, 50), rand_int(25, 32), 0);
    }
    CreateShot01(GetX, GetY, rand(0.3, 1), angle + rand(-70, 70), rand_int(165, 172), 0);
   }
  }
 }

#include_function ".\CN[ht@C.txt"

}